package com.mes.basicdata.domain;

import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.JoinColumnOrFormula;
import org.hibernate.annotations.JoinColumnsOrFormulas;
import org.hibernate.annotations.JoinFormula;

import com.mes.common.domain.BasicModel;

/**
 * <p>
 * RoutingLink实体，记录工艺之间的关系。
 * </p>
 * 
 */
public class RoutingLink extends BasicModel {

	@Id
	@GenericGenerator(name = "uniqueId", strategy = "assigned")
	@Column(name="UNIQUEID")
	private String uniqueId;
	
	@Column(name="SUC_ROUTING")
	protected String succRoutingUid;
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="SUC_ROUTING",insertable=false,updatable=false)
	protected Routing succRouting;
	
	@Column(name="PRE_ROUTING")
	protected String predRoutingUid;
	@ForeignKey(name="null")
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="PRE_ROUTING",insertable=false,updatable=false)
	protected Routing predRouting;
	
	/**
	 * 类型与状态映射--linktype
	 */
	@Column(name="LINKTYPE")
	protected Integer linkType;
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumnsOrFormulas(value={
			@JoinColumnOrFormula(column=@JoinColumn(name="LINKTYPE",referencedColumnName="ID",nullable=true,insertable=false,updatable=false)),
			@JoinColumnOrFormula(formula=@JoinFormula(value="'linktype'", referencedColumnName="TYPESNAME"))
	})
	protected TypesData linkTypeDesc;
	
	@Column(name="ROUTING")
	protected String routingUid;
	
	
	/**
	 * 空的构造函数
	 */
	public RoutingLink() {
	}


	public String getSuccRoutingUid() {
		return succRoutingUid;
	}


	public void setSuccRoutingUid(String succRoutingUid) {
		this.succRoutingUid = succRoutingUid;
	}


	public Routing getSuccRouting() {
		return succRouting;
	}


	public void setSuccRouting(Routing succRouting) {
		this.succRouting = succRouting;
	}


	public String getPredRoutingUid() {
		return predRoutingUid;
	}


	public void setPredRoutingUid(String predRoutingUid) {
		this.predRoutingUid = predRoutingUid;
	}


	public Routing getPredRouting() {
		return predRouting;
	}


	public void setPredRouting(Routing predRouting) {
		this.predRouting = predRouting;
	}


	public Integer getLinkType() {
		return linkType;
	}


	public void setLinkType(Integer linkType) {
		this.linkType = linkType;
	}


	public TypesData getLinkTypeDesc() {
		return linkTypeDesc;
	}


	public void setLinkTypeDesc(TypesData linkTypeDesc) {
		this.linkTypeDesc = linkTypeDesc;
	}


	/**  
	 * routingUid.  
	 *  
	 * @return  the routingUid  
	 * @since   JDK 1.6  
	 */
	public String getRoutingUid() {
		return routingUid;
	}


	/**  
	 * routingUid.  
	 *  
	 * @param   routingUid    the routingUid to set  
	 * @since   JDK 1.6  
	 */
	public void setRoutingUid(String routingUid) {
		this.routingUid = routingUid;
	}

}